const express = require('express');

const mysql = require('mysql');

var db = mysql.createConnection({
    host:'localhost',
    user:'root',
    password:'root',
    database:'jy1608_blog',
    port:8889
});
//2.查询

module.exports = {
    query(sql){
        return new Promise((resolve,reject)=>{
            db.query(sql,function(err,data){
                if(err){
                    reject(err);
                }else{
                    resolve(data);
                }
            })
        })
    }
}
